/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controladores;


import Entidades.Area;
import Entidades.Rol;

import logica.jpaControllers.RolJpaController;
import java.util.List;
import logica.jpaControllers.AreaJpaController;

public class CtrlArea {
  public CtrlArea() {
    }
  
    public void guardarArea(Area area) {
        AreaJpaController ga = new AreaJpaController();
        ga.create(area);
}

    public void eliminarArea(Area area) throws Exception{
        AreaJpaController ga = new AreaJpaController();
        ga.destroy(area.getIdArea());
    }

    public void modificarArea(Area area) throws Exception {
        AreaJpaController ga = new AreaJpaController();
        ga.edit(area);
    }


    public Area buscarArea_X_idArea(int area){
        AreaJpaController ga = new AreaJpaController();
        return ga.findArea(area);

    }

    public Area buscarAreaNombre(String nom) throws Exception{
        AreaJpaController ga = new AreaJpaController();
        return ga.findArea_x_nombre(nom);
    }

    public List buscarTodosArea() throws Exception{
        AreaJpaController ga = new AreaJpaController();
        return ga.findAreaEntities();
    }

}
